//
//  DDCommentDic.h
//  MyClouds
//
//  Created by sarah doo on 13-8-11.
//  Copyright (c) 2013年 sarah doo. All rights reserved.
//



#define CLOUD_SIGNATURE					@"cPxS"
#define CLOUD_PHOTO                     @"photo"
#define CLOUD_MUSIC                     @"music"
#define CLOUD_FILE                      @"file"
#define CLOUD_VIDEO                     @"video"
#define CLOUD_VERSION_1_0				0x00010000

#define MAX_PACKET_SIZE					1024 * 8		//! 发送的包最大不允许超过这个大小

#define MAX_PATH						260

#define UDP_BROADCAST_PORT				3767		//! 广播到此端口
#define UDP_RECV_PORT					3768		//! 通过此端口接受消息
#define TCP_LISTEN_PORT					3769		//! 通过此端口接受消息
#define BROADCAST_ADDRESS				0xE0030101	//! 组播地址 224.0.1.1
#define BROADCAST_ADDRESS_STR           @"224.3.1.1"

#define CLOUD_NAME_LENGTH				128
#define CLOUD_ID_LENGTH					128
#define DEVICE_ID_LENGTH				128
#define DEVICE_NAME_LENGTH				128
#define DEVICE_TYPE_LENGTH				128
#define TOKEN_LENGTH					16
#define TOKEN_MASK_LENGTH				64
#define HEADER_LENGTH                   20

#define CloudCmd_AckFlag				0x00010000

#define CloudCmd_SearchAll				0x00000001
#define CloudCmd_SearchAllAck			(CloudCmd_SearchAll | CloudCmd_AckFlag)
#define CloudCmd_Search					0x00000002
#define CloudCmd_SearchAck				(CloudCmd_Search | CloudCmd_AckFlag)

#define CloudCmd_ExchangeTokenMask		0x00000003
#define CloudCmd_ExchangeTokenMaskAck	(CloudCmd_ExchangeTokenMask | CloudCmd_AckFlag)
#define CloudCmd_Login					0x00000004
#define CloudCmd_LoginAck				(CloudCmd_Login | CloudCmd_AckFlag)
#define CloudCmd_ExchangeInformation	0x00000005
#define CloudCmd_ExchangeInformationAck	(CloudCmd_ExchangeInformation | CloudCmd_AckFlag)
#define CloudCmd_SearchOther			0x00000006
#define CloudCmd_SearchOtherAck			(CloudCmd_SearchOther | CloudCmd_AckFlag)

#define CloudCmd_ReportFile				0x00000101
#define CloudCmd_ReportFileAck			(CloudCmd_ReportFile | CloudCmd_AckFlag)
#define CloudCmd_NewFile				0x00000102
#define CloudCmd_NewFileAck				(CloudCmd_NewFile | CloudCmd_AckFlag)
#define CloudCmd_DeleteFile				0x00000103
#define CloudCmd_DeleteFileAck			(CloudCmd_DeleteFile | CloudCmd_AckFlag)
#define CloudCmd_DownloadFile			0x00000104
#define CloudCmd_DownloadFileAck		(CloudCmd_DownloadFile | CloudCmd_AckFlag)
#define CloudCmd_UploadFile				0x00000105
#define CloudCmd_UploadFileAck			(CloudCmd_UploadFile | CloudCmd_AckFlag)
#define CloudCmd_RefreshFile			0x00000106
#define CloudCmd_RefreshFileAck			(CloudCmd_RefreshFile | CloudCmd_AckFlag)

#define CloudCmd_DownloadAddressBook	0x00000201
#define CloudCmd_DownloadAddressBookAck	(CloudCmd_DownloadAddressBook | CloudCmd_AckFlag)
#define CloudCmd_UploadAddressBook		0x00000202
#define CloudCmd_UploadAddressBookAck	(CloudCmd_UploadAddressBook | CloudCmd_AckFlag)

#define CloudCmd_Logout					0x00001000

#define CloudCmd_Heartbeat				0x00002000

#define CloudCmd_CancelDownloadFile     0x00000107
#define CloudCmd_CancelDownloadFileAck  (CloudCmd_CancelDownloadFile | CloudCmd_AckFlag)

#define FILE_INFO_LENGTH                (4 + 8 + MAX_PATH)

#define SERVER_CODE 1
#define LOCAL_CODE 2

#define INT_SIZE 4
#define LONG_SIZE 8

#define LOGIN_SUCCESS 0
#define LOGIN_ERROR_PWD 1
#define LOGIN_TIMEOUT 2

#define DOWNLOAD_SUCCESS 0
#define DOWNLOAD_FAILED 1
#define DOWNLOAD_CANCEL 2

#define MOBILE @"mobile"
#define HOME @"home"
#define WORK @"work"
#define IPHONE @"iPhone"

#define SERVER_CLOUD_ID_KEY @"server_cloud_id"
#define SERVER_CLOUD_NAME_KEY @"server_cloud_name"
#define SERVER_CLOUD_TYPE_KEY @"server_cloud_type"

#define LOGIN_DELAY 10
